export class AppError extends Error {
  public type: string
  public code?: string

  constructor(
    public statusCode: number,
    message: string,
    type?: string,
    code?: string,
    public isOperational = true
  ) {
    super(message)
    this.type = type || 'UNKNOWN_ERROR'
    this.code = code
    Object.setPrototypeOf(this, AppError.prototype)
  }
}
